Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 7ba2b826485930383d537f0e304e07d3ccf88bce


Parents : 61c2c2b
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Signature : T66BB85Valid, signed by author
Date : 2026-07-07T02:04:03+02:00

Codec string formatters

Changes

5 files changed, 28 insertions(+), 4 deletions(-)


Diff

diff --git a/LXST/Codecs/Codec.py b/LXST/Codecs/Codec.py
index 001af79..4b74d5f 100644
--- a/LXST/Codecs/Codec.py
+++ b/LXST/Codecs/Codec.py
@@ -13,6 +13,8 @@ class Codec():
source = None
sink = None
+ def __str__(self): return f"<LXST/Codec>"
+
class CodecError(Exception):
pass
@@ -26,6 +28,8 @@ class Null(Codec):
def decode(self, frame):
return frame
+ def __str__(self): return f"<LXST/NullCodec>"
+
def resample_bytes(sample_bytes, bitdepth, channels, input_rate, output_rate, normalize=False):
sample_width = bitdepth//8
audio = AudioSegment(

diff --git a/LXST/Codecs/Codec2.py b/LXST/Codecs/Codec2.py
index d80f570..c4619d0 100644
--- a/LXST/Codecs/Codec2.py
+++ b/LXST/Codecs/Codec2.py
@@ -120,4 +120,6 @@ class Codec2(Codec):
frame_samples = np.zeros((len(decoded_samples), 1), dtype="float32")
frame_samples[:, 0] = decoded_samples
- return frame_samples
\ No newline at end of file
+ return frame_samples
+
+ def __str__(self): return f"<LXST/Codec2 @ {RNS.prettyspeed(self.mode)}>"
\ No newline at end of file

diff --git a/LXST/Codecs/Opus.py b/LXST/Codecs/Opus.py
index a3e7b02..733cd84 100644
--- a/LXST/Codecs/Opus.py
+++ b/LXST/Codecs/Opus.py
@@ -24,6 +24,19 @@ class Opus(Codec):
PROFILE_AUDIO_HIGH = 0x07
PROFILE_AUDIO_MAX = 0x08
+ @staticmethod
+ def profile_name(profile):
+ if profile == Opus.PROFILE_VOICE_LOW: return "Voice, Low"
+ elif profile == Opus.PROFILE_VOICE_MEDIUM: return "Voice, Medium"
+ elif profile == Opus.PROFILE_VOICE_HIGH: return "Voice, High"
+ elif profile == Opus.PROFILE_VOICE_MAX: return "Voice, Max"
+ elif profile == Opus.PROFILE_AUDIO_MIN: return "Audio, Min"
+ elif profile == Opus.PROFILE_AUDIO_LOW: return "Audio, Low"
+ elif profile == Opus.PROFILE_AUDIO_MEDIUM: return "Audio, Medium"
+ elif profile == Opus.PROFILE_AUDIO_HIGH: return "Audio, High"
+ elif profile == Opus.PROFILE_AUDIO_MAX: return "Audio, Max"
+ else: return "Default"
+
def __init__(self, profile=PROFILE_VOICE_LOW):
self.frame_quanta_ms = self.FRAME_QUANTA_MS
self.frame_max_ms = self.FRAME_MAX_MS
@@ -166,4 +179,6 @@ class Opus(Codec):
decoded_samples = np.frombuffer(decoded_frame_bytes, dtype="int16")/self.TYPE_MAP_FACTOR
frame_samples = decoded_samples.reshape(len(decoded_samples)//self.channels, self.channels)
- return frame_samples
\ No newline at end of file
+ return frame_samples
+
+ def __str__(self): return f"<LXST/Opus @ {self.profile_name(self.profile)}>"
\ No newline at end of file

diff --git a/LXST/Codecs/Raw.py b/LXST/Codecs/Raw.py
index 78d0c84..878cf33 100644
--- a/LXST/Codecs/Raw.py
+++ b/LXST/Codecs/Raw.py
@@ -57,4 +57,6 @@ class Raw(Codec):
frame_samples = frame_samples.reshape(len(frame_samples)//frame_channels, frame_channels)
if not self.channels: self.channels = frame_channels
- return frame_samples
\ No newline at end of file
+ return frame_samples
+
+ def __str__(self): return f"<LXST/Raw @ {RNS.prettyspeed(self.channels*self.bitdepth*48000)}>"
\ No newline at end of file

diff --git a/LXST/Filters.py b/LXST/Filters.py
index 29f2c2c..da0aaca 100644
--- a/LXST/Filters.py
+++ b/LXST/Filters.py
@@ -336,6 +336,7 @@ class EchoSuppressor(Filter):
self.preemph_alpha = preemph_alpha
self.acc_forget = acc_forget
self.estimate_every_n = estimate_every_n
+ self.debug_metrics = False
self.cng_enabled = cng_enabled
self.cng_gain = cng_gain
@@ -931,7 +932,7 @@ class EchoSuppressor(Filter):
output = output + cng[:, np.newaxis]
output = np.clip(output, -1.0, 1.0)
- RNS.log(f"GT: {self._current_gain < 0.5}, nA: {near_end_active}, EC: {echo_correlated}, SER: {round(self.ser_db,2)} dB, coupling: {round(self._coupling_db,2)} dB, finish {RNS.prettyshorttime(time.time()-st)}", RNS.LOG_DEBUG)
+ if self.debug_metrics: RNS.log(f"GT: {self._current_gain < 0.5}, nA: {near_end_active}, EC: {echo_correlated}, SER: {round(self.ser_db,2)} dB, coupling: {round(self._coupling_db,2)} dB, finish {RNS.prettyshorttime(time.time()-st)}", RNS.LOG_DEBUG)
return output


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────